var http = require('http');
var fs = require('fs');
var path = require('path');

http.createServer((req, res) => {
    var filePath = path.join(__dirname, '/2.txt');
    var readable = fs.createReadStream(filePath);

    /* 将可读流输出为可写流 */
    readable.pipe(res); //res是一个可写流，有继承
}).listen(8081)
console.log('server listening on');